<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        #div1{
            height: 200px;
            width: 200px;
            background: green
        }

    </style>
</head>
<body>
<!--<h3>初级arguments</h3>
<script>
 function show(){
     var result=0
    for (var i=0;i<arguments.length;i++){
        result+=arguments[i];
    }
    return result;
 }
 alert(show(3,5))
</script>
<br>
<hr>
<br>
<h3>中级arguments</h3>
<script>
    function m() {
        var result=0;
        for (var i=0;i<arguments.length;i++) {
            result+=arguments[i];
        }
        return result;
    }
    alert(m(3,5,8,3,5,8,3,5,8,3,5,8,3,5,8))
</script>-->


<h3>高级arguments</h3>
<div id="div1" style=""></div>
<script>
function css() {
    if(arguments.length==2){
        return arguments[0].style[arguments[1]];
    }else {
        arguments[0].style[arguments[1]]=arguments[2];
    }
}


    function getStyle(obj,name) {
        if(obj.currentStyle){
            return obj.currentStyle[name];

        }else{
            return getComputedStyle(obj,false)[name];
        }
    }
    window.onload=function () {
        var oDiv=document.getElementById("div1");

        alert(getStyle(oDiv,'width'));
        alert(getStyle(oDiv,'background-color'));
        css(oDiv,'background','red')
    }


</script>









</body>
</html>